-
Notifications
You must be signed in to change notification settings - Fork 13
fix: Show doubly nested definitions #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the issue where doubly nested function definitions were not being displayed on documentation pages. The change modifies the FuncTemplate component to recursively render nested function definitions using a new ScopedDefinitions component, ensuring that all levels of nested definitions (like outline.entry.indented) are properly shown in the documentation.
Key changes:
- Extract definition rendering logic into a reusable
ScopedDefinitionscomponent - Add recursive rendering for nested function scopes
- Update heading IDs and labels to reflect the nesting hierarchy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It worked fine on the outline page. LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution! It works perfectly on my end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
This PR will uncover doubly nested definitions, which were previously hidden.
Resolves #234
Example
outlineis a function.outline.entryis a function nested inoutlineoutline.entry.indentedis a function doubly nested inoutline.Currently,
indented,prefix, and other definitions underoutline.entryare missing in https://typst-jp.github.io/docs/reference/model/outline/. The last part on that page isfill, which is a parameter ofoutline.entry.This PR will add those definitions.
Preview
Official: https://typst.app/docs/reference/model/outline/

Before: https://typst-jp.github.io/docs/reference/model/outline/

After (preview with the upstream English dev docs): https://688e4447b70c7f0008cf9ff5--ydx-typst.netlify.app/docs/reference/model/outline/

Tips for reviewers
Please check the translationhttps://github.com/typst-jp/typst-jp.github.io/pull/238#discussion_r2250468953LLM and translators suggest:
In Chinese,
entry下的定義 is better (的 = の). But in Japanese, I don't know…The scope has at most two levels
You can verify it by searching
assets/docs.jsonwith ripgrep.There are still broken links due to an upstream bug
In the section Styling the outline > Building an Entry, the links to
indented,prefix, andinnerall point tooutline.entry, but they are expected to point tooutline.entry.{indented,prefix,inner}, respectively.These links are generated by typst-docs, and can hardly be fixed here.
I've fixed the bug in the upstream, but it won't take effect before typst-jp merges the uptream.
Considering that this page has not been translated yet, you can deal with this issue later.
In spite of it, links in 目次 and 引数 will behave normally, as they are generated by typst-jp.